import request from "@/api/index";
interface dataSourceType {
  [propName: string]: any;
}
export const checkCreatSiteForm = async (_rule: dataSourceType = {}, value: any, callback: any = () => { }) => {
  await function () { }()// 防止有些数据结构，比如数组的长度变化时，vue监听不到，所以添加一个空的await阻止一下下面的promise
  if (_rule.required) {
    if (value === '' || value === undefined || (_rule.type == 'Array' && !value.length)) {
      return Promise.reject(`${_rule.msg1}`);
    } else {
      return Promise.resolve()
    }
  } else {
    return Promise.resolve()
  }
};
const deleteKey = (key: string, obj: dataSourceType = {}) => {
  let params: dataSourceType = {};
  params[key] = obj.fullField;
  if (key == 'siteDomain' || key == 'siteDomainAlias') {
    params['siteProtocol'] = obj.params['siteProtocol']
  }
  return params
}